<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets">
    <body>
	  <h:panelGrid columns="2">
	  <h:panelGrid columns="2">
		<h:outputLabel value="Ders adı: "/>
        <h:outputLabel value="#{CourseBean.target.NAME}"/>
	  <h:outputLabel value="Dersin Öğretmeni: "/>
	  <p:commandLink value="#{CourseBean.target.TEACHER.fullName}" ajax="false" action="#{HomePageBean.clickTeacher()}">
		<f:setPropertyActionListener value="#{CourseBean.target.TEACHER}" target="#{TeacherBean.target}"/>
	  </p:commandLink>
	  </h:panelGrid>
		<p:commandButton value="Etkinlikleri Gör" icon="ui-icon-calendar" onclick="events.show();"/>
	  </h:panelGrid>
            <p:menubar rendered="#{CourseBean.coursesTeacher()}">
                <p:menuitem value="Ödev Ekle"  icon="ui-icon-tag" onclick="newHomework.show();" />
                <p:menuitem value="Sınav Sonuçu açıkla" icon="ui-icon-tag" onclick="announceExam.show();"/>
                <p:menuitem id="event" value="Duyuru Ekle" icon="ui-icon-contact" onclick="newAnnouncement.show();"/>
                <p:menuitem value="Etkinlik Ekle" icon="ui-icon-contact" onclick="newEvent.show();"/>
                <p:menuitem value="Mail Gönder" icon="ui-icon-mail-closed" onclick="newMail.show();"/>
            </p:menubar>
            <p:menubar>
                    <p:menuitem value="Ödevler" icon="ui-icon-tag" onclick="homeworks.show();"/>
                    <p:menuitem value="Forum"  icon="ui-icon-clipboard" action="#{HomePageBean.clickForum()}" ajax="false">
                            <f:setPropertyActionListener value="#{CourseBean.courseForum()}" target="#{ForumBean.target}"/>
                    </p:menuitem>
                    <p:menuitem value="Öğrenciler"  icon="ui-icon-person" onclick="students.show();"/>
            </p:menubar>
        <h:panelGrid columnClasses="column1,column1" width="100%" columns="2">
		<h:panelGroup>
		    <p:panel header="Duyurular">
                        <p:dataGrid paginator="true" paginatorAlwaysVisible="3" columns="1" emptyMessage="Duyuru bulunmamaktadır." value="#{CourseBean.anns}" var="ann">
				<p:column>
				    <h:panelGrid columns="2">
                                        <h:outputText escape="false" value="#{ann.text}"/>
					  <p:commandLink value="${ann.teacher.fullName}" action="#{HomePageBean.clickTeacher()}">
						<f:setPropertyActionListener value="#{ann.teacher}" target="#{TeacherBean.target}"/>
					  </p:commandLink>
				    </h:panelGrid>
				</p:column>
			  </p:dataGrid>
		    </p:panel>
		</h:panelGroup>
		<p:panel header="Dosyalar: ">
		    <h:outputLabel value="Dosyalar: "/>
		    <p:dataList var="file" value="#{CourseBean.files}">
			  <p:column>
				<h:panelGrid columns="1">
                                    <p:commandLink ajax="false" value="İndir (#{file.information})">
				    <f:setPropertyActionListener value="#{file.file}" target="#{HomeworkBean.targetFile}"/>
				    <p:fileDownload value="#{HomeworkBean.convert()}"/>
				</p:commandLink>
				    <h:outputLabel value="Açıklama: #{file.information}"/>
				</h:panelGrid>
			  </p:column>
		    </p:dataList>
		    <p:accordionPanel activeIndex="" rendered="#{CourseBean.coursesTeacher()}">
			  <p:tab title="Dosya Yükle">
				<h:panelGrid columns="2">
				<h:outputLabel value="Dosyayı Seçin"/>
				<p:fileUpload mode="simple" value="#{CourseBean.upload}"/>
				<h:outputLabel value="Detay: "/>
				<p:inputText value="#{CourseBean.info}"/>
				<p:commandButton value="Yükle" action="#{CourseBean.addFile()}" ajax="false"/>
				</h:panelGrid>
			  </p:tab>
		    </p:accordionPanel>
		</p:panel>
	
	  </h:panelGrid>
	  
	  <p:lightBox style="background: white;" id="box" visible="#{HomePageBean.box}" onHide="#{HomePageBean.makeBoxFalse()}" height="500" width="500">
		<h:outputLink value="#{HomePageBean.sayfaBox}" title="#{HomePageBean.boxTitle}"/>   
	  </p:lightBox>
    </body>
	  
</html>
